libotutil: avoid leaking builder memory on error
authorLuca BRUNO <luca.bruno@coreos.com>
Mon, 10 Jan 2022 09:30:11 +0000 (09:30 +0000)
committerLuca BRUNO <luca.bruno@coreos.com>
Mon, 10 Jan 2022 09:30:11 +0000 (09:30 +0000)
commit0b1a0856925c32fffa93c526b9f415d455d71a1d
treeada0dff8399dc28ec1dfd11ce5ef5abacaae89f6
parent6cb097fb5e765802008d91f745139f7ecbc6fbe4
libotutil: avoid leaking builder memory on error

This swaps the order of a couple of input sanity checks, in order
to fix a minor memory leak due to an early-return on the error
path.
Memory for the result is now allocated only after input has been
sanity-checked.
It fixes a static analysis warning highlighted by Coverity.
src/libotutil/ot-variant-builder.c